<?php

/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Sitealbum
 * @copyright  Copyright 2010-2011 BigStep Technologies Pvt. Ltd.
 * @license    http://www.socialengineaddons.com/license/
 * @version    $Id: _lightboxPhoto.tpl 2011-08-026 9:40:21Z SocialEngineAddOns $
 * @author     SocialEngineAddOns
 */
?>
<div class="photo_lightbox" id="album_light" style="display: none;">
<?php
$this->headScript()
        ->appendFile($this->seaddonsBaseUrl() . '/externals/moolasso/Lasso.js')
        ->appendFile($this->seaddonsBaseUrl() . '/externals/moolasso/Lasso.Crop.js')
        ->appendFile($this->seaddonsBaseUrl() . '/externals/autocompleter/Observer.js')
        ->appendFile($this->seaddonsBaseUrl() . '/externals/autocompleter/Autocompleter.js')
        ->appendFile($this->seaddonsBaseUrl() . '/externals/autocompleter/Autocompleter.Local.js')
        ->appendFile($this->seaddonsBaseUrl() . '/externals/autocompleter/Autocompleter.Request.js')
        ->appendFile($this->seaddonsBaseUrl() . '/externals/tagger/tagger.js')
        ->appendFile($this->seaddonsBaseUrl() . '/application/modules/Sitealbum/externals/scripts/core.js')
        ->appendFile($this->seaddonsBaseUrl() . '/application/modules/Album/externals/scripts/core.js');
$this->headTranslate(array(
    'Save', 'Cancel', 'delete',
));
?>
<?php
$this->headLink()
        ->appendStylesheet($this->seaddonsBaseUrl().'/application/modules/Socialengineaddon/externals/styles/style_photolightbox.css'
);
?>
<style type="text/css">
  .sitealbum_lightbox_image_content {background:<?php echo Engine_Api::_()->getApi('settings', 'core')->getSetting('sitealbum.photolightbox.bgcolor', '#000000'); ?>;}
  .sitealbum_lightbox_user_options{background:<?php echo Engine_Api::_()->getApi('settings', 'core')->getSetting('sitealbum.photolightbox.bgcolor', '#000000'); ?>;}
  .sitealbum_lightbox_user_right_options{background:<?php echo Engine_Api::_()->getApi('settings', 'core')->getSetting('sitealbum.photolightbox.bgcolor', '#000000'); ?>;}
  .sitealbum_lightbox_photo_detail{background:<?php echo Engine_Api::_()->getApi('settings', 'core')->getSetting('sitealbum.photolightbox.bgcolor', '#000000'); ?>;}
  .sitealbum_lightbox_user_options a,
  .sitealbum_lightbox_photo_detail,
  .sitealbum_lightbox_photo_detail a{color:<?php echo Engine_Api::_()->getApi('settings', 'core')->getSetting('sitealbum.photolightbox.fontcolor', '#FFFFFF') ?>;}
</style>

  <input type="hidden" id="canReloadSitealbum" value="0" />
  <div class="photo_lightbox_black_overlay"  ></div>
  <div class="photo_lightbox_white_content_wrapper" onclick = "closeLightBoxAlbum()">
    <div class="photo_lightbox_white_content"  id="white_content_default_album"  >
      <div id="image_div_album">       
        <div class="photo_lightbox_image_content album_viewmedia_container sitealbum_lightbox_image_content" id="media_image_div_sitealbum"></div>
        <div id="photo_lightbox_user_options"></div>
        <div class="" id="photo_lightbox_user_right_options"></div>
        <div class="photo_lightbox_text_content" id="photo_lightbox_text">
        </div>
      </div>
    </div>
  </div>


<script type="text/javascript">
  var locationHref=window.location.href;
  var defaultLoad=true;
  function openLightBoxAlbum(imagepath, url){ 
    document.getElementById('album_light').style.display='block';
    document.getElementById('media_image_div_sitealbum').innerHTML= "&nbsp;<img class='lightbox_photo' src="+imagepath+"  />";
    setHtmlScroll("hidden");
    photopaginationDefaultAlbum(url);
  }

 	window.addEvent('domready', function() {
    $('white_content_default_album').addEvent('click', function(event) {
      event.stopPropagation();
    });
  });
  
  var closeLightBoxAlbum = function()
  {
    defaultLoad=true;
    document.getElementById('album_light').style.display='none';
    setHtmlScroll("auto");
    
    if($('album_lightbox'))
      $('album_lightbox').innerHTML ="";

    if(document.getElementById('photo_lightbox_text')){
      document.getElementById('photo_lightbox_text').innerHTML="";
      document.getElementById('photo_lightbox_text').style.display="none";
    }
    if(document.getElementById('photo_lightbox_user_options'))
      document.getElementById('photo_lightbox_user_options').style.display="none";
    if(document.getElementById('sitealbum_photo_scroll'))
      document.getElementById('sitealbum_photo_scroll').style.display="none";
    if(document.getElementById('photo_lightbox_user_right_options'))
      document.getElementById('photo_lightbox_user_right_options').style.display="none";
    if(document.getElementById('photo_view_comment'))
      $('photo_view_comment').innerHTML="";
    if(document.getElementById('album_lightbox'))
      $('album_lightbox').innerHTML="";


    if (history.pushState)
      history.pushState( {}, document.title, locationHref );
    else{  
      window.location.href=locationHref;
    }

    if(document.getElementById('canReloadSitealbum').value==1){
      window.location.reload(true);
    }
    
  };

  var photopaginationDefaultAlbum = function(url)
  { 
    var photoUrl=url.replace("/sitealbums/", "/albums/");
    photoUrl=photoUrl.replace("/light-box-view/album_id/", "/view/album_id/");
    if (history.pushState)
      history.pushState( {}, document.title, photoUrl );
    else{
      window.location.hash =photoUrl;
    }
    if(document.getElementById('photo_lightbox_photo_detail'))
      document.getElementById('photo_lightbox_photo_detail').style.display="none";
    en4.core.request.send(new Request.HTML({
      url : url,
      data : {
        format : 'html',
        isajax : 0
      },
      onSuccess : function(responseTree, responseElements, responseHTML, responseJavaScript) {
       
        $('white_content_default_album').innerHTML = responseHTML;
        if($('ads') && $('ads_hidden')){
          $('ads').innerHTML =  $('ads_hidden').innerHTML;
          $('ads_hidden').innerHTML='';
        }
      }
    }));
  };

  function setHtmlScroll(cssCode) {
    $$('html').setStyle('overflow',cssCode);
    
  }

  function setImageScrollAlbum(cssCode) {
    $$('.photo_lightbox_white_content_wrapper').setStyle('overflow',cssCode);

  }

</script>
</div>